package com.demo.netty.http.handler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

public class HttpServerChannelInitializer extends ChannelInitializer<SocketChannel> {


    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        //netty提供的httpServerCodec
        //1.HttpServerCodec是netty提供的http处理编解码器
        //2.
        pipeline.addLast("myHttpServerCodec", new HttpServerCodec())
                .addLast("myBizHandler", new HttpServerHandler());
    }
}
